package com.yjz.leetcode.二叉树学习.二叉搜索树;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * @author :yuanJinZhong
 * @description: 二叉树的节点
 * @date :2018/11/24-15:07
 */
@Getter
@Setter
public class Node<T extends Comparable<? extends T>> {
  /**
   * 节点数据
   */
  private T data;
  /**
   * 左子节点
   */
  private Node<T> leftChild;
  /**
   * 右子节点
   */
  private Node<T> rightChild;

  public Node(T data) {
    this.data = data;
  }

  /**
   * 打印节点数据
   */
  public void display() {
    System.out.println(data.toString());
  }

  @Override
  public String toString() {
    return "Node{" +
      "data=" + data +
      ", leftChild=" + leftChild +
      ", rightChild=" + rightChild +
      '}';
  }
}
